#include <stdlib.h>
#include "BinaryTree.h"

//创建新节点
TreeNode* createNode(DataType data){
    TreeNode* newNode = (TreeNode*)malloc(sizeof(TreeNode));
    if (newNode != NULL){
        newNode->data = data;
        newNode->left = NULL;
        newNode->right = NULL;
    }
    return newNode;
}

//销毁整颗树
void destroyTree(TreeNode* root){
    if(root == NULL) return;

    destroyTree(root->left);
    destroyTree(root->right);
    free(root);
}